import os
import tornado.web
import tornado.ioloop

from tornado.options import define,options,parse_command_line
from face.views import InitHandler,RegisterHandler,LoginHandler

define('port',default=8082,type=int)

def make_app():
    return tornado.web.Application(handlers=[
        (r'/init_db/',InitHandler),
        (r'/login/',LoginHandler),
        (r'/register/',RegisterHandler),
    ],template_path=os.path.join(os.path.dirname(__file__),'templates'),static_path=os.path.join(os.path.dirname(__file__),'static'),autoreload=True,debug=True)


if __name__ == "__main__":
    parse_command_line()
    app = make_app()
    app.listen(options.port,address='0.0.0.0')
    tornado.ioloop.IOLoop.current().start()